package com.bhs.sansong.ui.setting;

import androidx.appcompat.app.AppCompatActivity;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.bhs.sansong.R;
import com.bhs.sansong.base.BaseActivity;
import com.bhs.sansong.net.Config;
import com.bhs.sansong.ui.other.WebViewActivity;

public class SecondaryPageActivity extends BaseActivity implements View.OnClickListener {


    private TextView mTvTitle;
    private LinearLayout mLlUserAgreement;
    private LinearLayout mLlPrivacyAgreement;
    private LinearLayout mLlTransportationAgreement;

    @Override
    public int initLayout() {
        return R.layout.activity_secondary_page;
    }

    @Override
    public void initView() {

        mTvTitle = findViewById(R.id.tv_title);
        mLlUserAgreement = findViewById(R.id.ll_user_agreement);
        mLlPrivacyAgreement = findViewById(R.id.ll_privacy_agreement);
        mLlTransportationAgreement = findViewById(R.id.ll_transportation_agreement);
        mLlUserAgreement.setOnClickListener(this);
        mLlPrivacyAgreement.setOnClickListener(this);
        mLlTransportationAgreement.setOnClickListener(this);
        mTvTitle.setText("法律条款");
    }

    @Override
    public void initData() {

    }

    @SuppressLint("NonConstantResourceId")
    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.ll_user_agreement:
                startActivity(new Intent(mActivity, WebViewActivity.class)
                        .putExtra("url", Config.getUserProtocolUrl())
                        .putExtra("title", "用户协议"));
                break;
            case R.id.ll_privacy_agreement:
                startActivity(new Intent(mActivity, WebViewActivity.class)
                        .putExtra("url", Config.getPrivacyPolicyUrl())
                        .putExtra("title", "隐私协议"));
                break;
            case R.id.ll_transportation_agreement:
                startActivity(new Intent(mActivity, WebViewActivity.class)
                        .putExtra("url", Config.getTransportationUrl())
                        .putExtra("title", "货物运输协议"));
                break;
        }
    }
}